package com.github.springcloud.order.controller;

import com.github.springcloud.order.api.OrderService;
import com.github.springcloud.order.dto.CreateOrderDto;
import com.github.springcloud.order.vo.OrderVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Created by zhaozuowen on 2018/7/12.
 */
@RestController
@RequestMapping("/order")
public class OrderServiceController {

    @Autowired
    public OrderService orderService;


    @RequestMapping(value = "/createOrder",method = RequestMethod.POST)
    public void createOrder(@RequestBody  CreateOrderDto createOrderDto){

        orderService.createOrder(createOrderDto);
    }

    @RequestMapping(value = "/getByOrderNo/{orderNo}",method = RequestMethod.GET)
    public OrderVo getByOrderNo(@PathVariable("orderNo") String orderNo){

       return orderService.getByOrderNo(orderNo);
    }
}
